/*
 * @Author: zhuxiaoyi
 * @Date: 2024-01-26 16:09:04
 * @LastEditor: zhuxiaoyi
 * @LastEditTime: 2025-01-22 18:58:11
 * @Description:
 */
import {
  Body,
  Controller,
  Del,
  Get,
  Inject,
  Param,
  Put,
  Query,
  Post
} from '@midwayjs/core';
import { AlgorithmTypeService } from '../service/algorithmType.service';
import { AlgorithmTypeDto,AlgorithmUpdateTypeDto } from '../dto/AlgorithmTypeDto'


@Controller('/algorithmType')
export class AlgorithmTypeController {
  @Inject()
  algorithmTypeService: AlgorithmTypeService;

  @Get('/getTree', { summary: '算法类型树形列表' })
  async algorithmTypes() {
    return await this.algorithmTypeService.algorithmTypes();
  }

  @Post('/addType', { summary: '添加分类'})
  async addType(@Body() params:AlgorithmTypeDto ) {
    return await this.algorithmTypeService.addType(params);
  }
  @Put('/updateType', { summary: '添加分类'})
  async updateType(@Body() params:AlgorithmTypeDto ) {
    return await this.algorithmTypeService.updateType(params);
  }

  @Del('/deleteType/:id', { summary: '删除分类'})
  async deleteType(@Param('id') id: string) {
    return await this.algorithmTypeService.deleteType(id);
  }

 
  @Put('/updateAlgorithmType/:id', { summary: '更新算法所属分类'})
  async updateAlgorithmType(@Param('id') id: string,@Body() params:AlgorithmUpdateTypeDto) {
    return await this.algorithmTypeService.updateAlgorithmType(id,params);
  }
}
